package cn.lili.modules.store.entity.enums;

import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.enums.SceneEnums;

public enum StoreSceneEnum {


    STORE("商家端"),

    SUPPLIER("供应商端");
    private final String description;

    StoreSceneEnum(String description) {
        this.description = description;
    }

    public String value() {
        return this.name();
    }

    public static StoreSceneEnum defaultValue() {
        return STORE;
    }

    /**
     * 获取场景
     *
     * @param scene
     * @return
     */
    public static SceneEnums getScene(String scene) {
        try {
            return SceneEnums.valueOf(scene);
        } catch (IllegalArgumentException e) {
            throw new ServiceException(ResultCode.SCENE_NOT_SUPPORT);
        }
    }
}
